package com.kcht.np.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kcht.np.entity.SysUser;
import com.kcht.np.common.jwt.JwtUser;
import com.kcht.np.vo.page.QueryParameter;
import com.kcht.np.vo.user.*;
import org.springframework.security.core.AuthenticationException;

import java.util.Set;

/**
  * <p>
  * 用户 Service 接口
  * </p>
  *
  * @Package:        com.kcht.np.mp.service
  * @Description:    用户 Service 接口
  * @Author:         liuqi
  * @CreateDate:     2020/3/31 21:34
 */

public interface SysUserService extends IService<SysUser> {

    /**
     *重新设置用户角色
     */
    void resetUserRoles(Long uid, Set<Long> roleIds);

    /**
     * @Description: 用户登录
     * @param:       username password
     * @return:      String token 值
     * @Author:      liuqi
     * @CreateDate:  2020/3/31 21:34
     */
    String login(String username, String password) throws AuthenticationException;

    /**
     * 用户退出登录
     */
    void logout();

    /**
     * 返回一个jwtuser
     */
    JwtUser getJwtUser(String username) throws AuthenticationException;

    /**
     * 用户查询个人信息
     */
    UserVo userQueryPersonalInfo();

    /**
     * 根据相关参数分页获取多个用户详细信息
     */
    IPage<SysUserVo> pagingQueryUsers(QueryParameter parameter);


    boolean userUpdateSelf(UserCanModifyInfo entity);

    void deleteUser(Long uid);

    void save(UserCanCreateInfo entity);

    void updateDept(Long uid,Long deptId);

    boolean updateById(ManagerCanModifyInfo user);
}
